<?php
class ecDateInput extends ecFormElement
{
	public function format($format)
	{
		if(!preg_match('#[dmyY]+#isU', $format)) return FALSE;
		$this->regex =  '#'.str_replace(array('d', 'm', 'y', 'Y'), '[0-9]', $format).'#';

		return $this;
	}

	public function getHtml()
	{
		return '<label for="'.$this->name.'">'.$this->label.'</label> : <input type="text" name="'.$this->name.'" id="'.$this->name.'" value="'.$this->value.'" maxlength="'.$this->maxlength.'" />';
	}
}
